# #图片ID
# body > div.wrap > em > div.store_list_wrap > div.store_collist > div:nth-child(1) > div.bookimg > a > img 
# #书名
# body > div.wrap > em > div.store_list_wrap > div.store_collist > div:nth-child(1) > div.bookinfo > div.bookname > a
# #类型
# body > div.wrap > em > div.store_list_wrap > div.store_collist > div:nth-child(1) > div.bookinfo > div.bookilnk > a:nth-child(2)
# #更新时间
# body > div.wrap > em > div.store_list_wrap > div.store_collist > div:nth-child(1) > div.bookinfo > div.bookilnk > span:nth-child(4)
# #作者名
# body > div.wrap > em > div.store_list_wrap > div.store_collist > div:nth-child(1) > div.bookinfo > div.bookilnk > a:nth-child(1)
import requests
from lxml import etree
url = 'http://book.zongheng.com/store.html'
response = requests.get(url)
print(response.status_code)
html = response.text
num = 0
allnum = 0

ehtml = etree.HTML(html)

bookname = ehtml.cssselect('.bookname>a')
imageID = ehtml.cssselect('.bookimg>a>img')
booktype = ehtml.cssselect('.bookilnk>a:nth-child(2)')
updateTime = ehtml.cssselect('.bookilnk>span:nth-child(4)')
author = ehtml.cssselect('.bookilnk>a:nth-child(1)')
print("书名|图片链接|类型|更新时间|作者名")
for i in bookname:
    print(i.text)
for i in imageID:
    print(i.attrib['src'])
for i in booktype:
    print(i.text)
for i in updateTime:
    print(i.text)
for i in author:
    print(i.text)

